package com.web.service;

import com.web.dao.*;
import com.web.entity.*;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class VipService {
    @Resource
    private VipMapper vipMapper;
    @Resource
    private RMBRecordMapper recordMapper;
    @Resource
    private VIPUserInfoMapper vipUserInfoMapper;
    @Resource
    private ChargeManageInfoMapper chargeManageInfoMapper;
    @Resource
    private UserDataMapper dataMapper;
    @Resource
    private CurrencyRecordMapper currencyRecordMapper;
    /**
     * 获取所有会员
     * @return
     */
    public List<VipInfo> getVIPInfo() {
        return vipMapper.getVIPInfo();
    }

    /**
     * 根据条件查询指定数据
     * @param key
     * @param value
     * @return
     */
    public VipInfo selectById(String key,String value){
        return vipMapper.selectById(key,value);
    }

    /**
     * 插入一条流水记录
     */
    public void addRMBRecord(RMBRecord record){
        recordMapper.insertSelective(record);
    }
    /**
     * 修改一条记录
     */
    public void uploadRMBRecord(RMBRecord record){
        recordMapper.updateByPrimaryKeySelective(record);
    }

    /**
     * 查询一条流水记录
     * @param key
     * @param value
     * @return
     */
    public RMBRecord selectByIdRMB(String key ,String value){
       return recordMapper.selectById(key,value);
    }

    /**
     * 添加一条会员记录
     * @param info
     */
    public void addVIPUserInfo(VIPUserInfo info){
        vipUserInfoMapper.insertSelective(info);
    }

    /**
     * 获取充值基础信息
     * @return
     */
    public List<ChargeManageInfo> chargeManageInfos(){
        return chargeManageInfoMapper.allInfo();
    }

    /**
     * 根据ID查出模豆充值基本信息
     * @param key
     * @param value
     * @return
     */
    public ChargeManageInfo selectByIdChargeManageInfo(String key,String value){
        return chargeManageInfoMapper.selectById(key,value);
    }

    /**
     * 根据ID查出资料信息
     * @param key
     * @param value
     * @return
     */
    public UserData selectByIdUserData(String key,String value){
        return dataMapper.selectById(key,value);
    }


    /**
     * 获取我的模豆使用明细
     * @param userId
     * @return
     */
    public List<CurrencyDetailsBean> getCurrencyDetails(String userId){
        return currencyRecordMapper.getCurrencyDetails(userId);
    }
    /**
     * 获取我的模豆使用保证金明细
     * @param userID
     * @return
     */
    public List<CurrencyDetailsBZJBean> getCurrencyDetailsBZJ(String userID){
        return currencyRecordMapper.getCurrencyDetailsBZJ(userID);
    }
}
